import Mock from 'mockjs';
import { resultSuccess } from '../_util';

const Random = Mock.Random;

const token = Random.string('upper', 32, 32);

const adminInfo = {
  userId: '1',
  username: 'admin',
  realName: 'Admin',
  avatar: Random.image(),
  desc: 'manager',
  password: Random.string('upper', 4, 16),
  token,
  permissions: [
    {
      label: '主控台',
      value: 'dashboard_console',
    },
    {
      label: '监控页',
      value: 'dashboard_monitor',
    },
    {
      label: '工作台',
      value: 'dashboard_workplace',
    },
    {
      label: '基础列表',
      value: 'basic_list',
    },
    {
      label: '基础列表删除',
      value: 'basic_list_delete',
    },
  ],
};

const userBasicInfo={
  "code": 200,
  "meta": {
    "authArrs": [
      {
        "routerDesc": "基础数据统计分析",
        "routerName": "数据",
        "routerUrl": "/data"
      },
      {
        "routerDesc": "游戏基础配置",
        "routerName": "游戏",
        "routerUrl": "/game"
      },
      {
        "routerDesc": "红包活动",
        "routerName": "活动",
        "routerUrl": "/activity"
      },
      {
        "routerDesc": "游戏玩家",
        "routerName": "玩家",
        "routerUrl": "/player"
      },
      {
        "routerDesc": "游戏直播监控",
        "routerName": "直播",
        "routerUrl": "/live"
      }
    ],
    "phone": "321",
    "role": "admin",     //用户角色类型（系统管理员admin、超级管理员super）
    "status": "able",     //用户状态（able/disable）：disable表名当前用户被禁用，不可用
    "token": token,
    "userid": 2,
    "username": "admin"
  }
}

export default [
  {
    url: '/api/login',
    timeout: 1000,
    method: 'post',
    response: () => {
      return userBasicInfo
  }
  },
  {
    url: '/api/admin_info',
    timeout: 1000,
    method: 'get',
    response: () => {
      // const token = getRequestToken(request);
      // if (!token) return resultError('Invalid token');
      return resultSuccess(adminInfo);
    },
  },
];
